<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title></title>
    <script src="js/vue/vue.min.js"></script>
    <script src="js/vue/moment.min.js"></script>
    <script src="js/js-cookie/js.cookie.min.js"></script>
    <script src="js/jquery/jquery.min.js"></script>
    <script src="js/jquery/jquery.form.js"></script>
    <script src="js/vue/common.js"></script>


</head>

<script>
    $(function () {
        $("#_js_loginBtn").click(function () {
            $("#_j_login_form").ajaxSubmit({
                url: "http://localhost:8080/user/login",
                type: "POST",
                success: function (data) {
                    console.log(data);
                    if (data.code == 200) {
                        var map = data.data;
                        var token = map.token;
                        var user = map.user;

                        Cookies.set('user', JSON.stringify(user), { expires: 1/48,path:'/'});
                        Cookies.set('token', token, { expires: 1/48,path:'/'});

                        window.location.href="http://localhost:8080/index.html";
                    } else {
                        popup(data.msg);
                    }
                }
            })
        })
    })
</script>

<body>
<div class="wrapper">
    <div class="container container-login">
        <div class="signup-forms flip">
            <div class="login-box" id="_j_login_box">
                <div class="inner inner_v2 clearfix">
                    <div class="inner_v2_left">
                        <form id="_j_login_form" method="post">
                            <div class="form-field">
                                <input name="username" type="text" placeholder="您的账号" autocomplete="off"
                                       data-verification-name="帐号">
                                <div class="err-tip"></div>
                            </div>
                            <div class="form-field">
                                <input name="password" type="password" placeholder="您的密码" autocomplete="off"
                                       data-verification-name="密码"
                                       class="verification[required,minSize[4],maxSize[50]]">
                                <div class="err-tip"></div>
                            </div>
                            <div class="submit-btn">
                                <button id="_js_loginBtn" type="button">登 录</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>